import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
 
// 用来存储数据
const state = {
    username:0,
    course_id:0,
    chname:"QAQ",
    userId:0,
    pfbzmsg:[],
    pfbz:[],
    dbrId:0,
    authority:0
}
// 响应组件中的事件
const actions = {
 
}
// 操作数据
const mutations = {
    setCourseId(state,value){
        state.course_id = value
    },
    setUsername(state,value){
        // state.username = value
        localStorage.setItem('username', value);
    },
    setChname(state,value){
        localStorage.setItem('chname', value);
    },
    setUserId(state,value){
        // state.userId = value
        localStorage.setItem('userId', value);
    },
    setPfbzmsg(state,value){
        state.pfbzmsg = value
    },
    setPfbz(state,value){
        state.pfbz = value
    },
    setdbrId(state,value){
        state.dbrId = value
    },
    setAuthority(state,value){
        localStorage.setItem('authority', value);
    },
}
// 用来将state数据进行加工
const getters = {
 
}
// 新建并暴露store
export default new Vuex.Store({
    state,
    actions,
    mutations,
    getters
})
 